package com.scl.online.timewheel.test;

import com.scl.online.timewheel.timing.Timeout;
import com.scl.online.timewheel.timing.Timer;
import com.scl.online.timewheel.timing.TimerTask;
import com.scl.online.timewheel.wheel.TimerWheel;

import java.util.Date;
import java.util.concurrent.TimeUnit;

public class Main implements TimerTask {
    final static Timer timer = new TimerWheel();


    public static void main(String[] args) {
        TimerTask timerTask = new Main();
        System.out.println("timeout: {}" + new Date());
        for (int i = 0; i < 10; i++) {
            timer.newTimeout(timerTask, 30, TimeUnit.SECONDS, "" + i);
        }
    }

    @Override
    public void run(Timeout timeout, String argv) throws Exception {
        System.out.println("timeout: {}" + new Date() + ",argv:" + argv);
    }
}
